package com.xinruke.hostels.common.exception;

import com.xinruke.hostels.common.vo.ErrorEnum;
import lombok.Data;

/**
 * @author GuoZheng
 * @ClassName BizException
 * @date：2019/6/27
 * @version: V1.0.0
 * @description：业务异常
 */
@Data
public class BizException extends RuntimeException {
    public final static long ERR_ARGUMENT = -1;//参数异常
    public final static long SERVER = -1;//参数异常
    public final static long EXIST = -1;//参数异常
    public final static long BIZ = -1;//参数异常

    private long code;
    private String message;

    public BizException() {
    }

    public BizException(String message) {
        this.code = BIZ;
        this.message = message;
    }

    public BizException(Long code, String message) {
        this.code = code;
        this.message = message;
    }

    public BizException(ErrorEnum errorEnum){
        this.code = errorEnum.getCode();
        this.message = errorEnum.getMsg();
    }

}
